
def is_conjugations (st1,st2):
    #单个字符重排列
    #复杂度O(n^2)
    if len(st1)!=len(st2):
        return False
    elif st1 == st2:
        return True
    else:
        if is_same(st1,st2):
            return True
        else:
            return False

def is_same(st11,st22):
    st1 = list(st11)
    st2 = list(st22)
    for letter_index in range(len(st1)):
        if st1[letter_index] in st2:
            #if in 的复杂度为O(n)
            st2.remove(st1[letter_index])
            print(st2)
    if (len(st2)==0):
        return True
    else:
        return False

def sort_judege(str1,str2):
    #排序后再选择
    #复杂度O(n*log n)
    list1 = list(str1)
    list1.sort()
    list2 = list(str2)
    list2.sort()
    flag = True
    for i in range(len(list1)):
        if list1[i] != list2[i]:
            flag = False
    return flag

def counter_camp(str1,str2):
    #字典映射，最优解
    #O(n)，最优解
    dic1 = {"a":0,"b":0,"c":0,"d":0,"e":0,"f":0,"g":0,
            "h":0,"i":0,"j":0,"k":0,"l":0,"m":0,"n":0,
            "o":0,"p":0,"q":0,"r":0,"s":0,"t":0,"u":0,
            "v":0,"w":0,"x":0,"y":0,"z":0}
    dic2 = dic1.copy()
    #不能使用dic2 = dic1，因为后续操作都是一个了。
    for lette in str1:
        dic1[lette]+=1
    for lette in str2:
        dic2[lette]+=1

    #print(dic1)
    #print(dic2)
    if dic1==dic2:
        return True
    else:
        return False


if __name__ == '__main__':
    print(counter_camp("typhon","pyhton"))
